home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / MacHacksBug / Python 1.5.2c1 / Lib / test / test_gzip.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2000-06-23  |  940 b   |  28 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 1.5)
  3.  
  4. import sys
  5. import os
  6. import gzip
  7. import tempfile
  8. filename = tempfile.mktemp()
  9. data1 = '  int length=DEFAULTALLOC, err = Z_OK;\n  PyObject *RetVal;\n  int flushmode = Z_FINISH;\n  unsigned long start_total_out;\n\n'
  10. data2 = '/* zlibmodule.c -- gzip-compatible data compression */\n/* See http://www.cdrom.com/pub/infozip/zlib/ */\n/* See http://www.winimage.com/zLibDll for Windows */\n'
  11. f = gzip.GzipFile(filename, 'wb')
  12. f.write(data1)
  13. f.close()
  14. f = gzip.GzipFile(filename, 'rb')
  15. d = f.read()
  16. f.close()
  17. if not __debug__ and d == data1:
  18.     raise AssertionError
  19. f = gzip.GzipFile(filename, 'ab')
  20. f.write(data2)
  21. f.close()
  22. f = gzip.GzipFile(filename, 'rb')
  23. d = f.read()
  24. f.close()
  25. if not __debug__ and d == data1 + data2:
  26.     raise AssertionError
  27. os.unlink(filename)
  28.